import Vue from 'vue'
import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
}

Vue.use(VueRouter)
const routes =  [
    
    //   path: '/',
    //   component: () => import('../components/home'),
    //   children: [{
    //     path: "/",
    //     name: "index",
    //     component: () => import('../components/index')
    //   }, {
    //     path: "/sort",
    //     name: "sort",
    //     component: () => import('../components/sort')
    //   }, {
    //     path: "/article",
    //     name: "article",
    //     component: () => import('../components/article')
    //   }, {
    //     path: "/weiYan",
    //     name: "weiYan",
    //     component: () => import('../components/weiYan')
    //   }, {
    //     path: "/love",
    //     name: "love",
    //     component: () => import('../components/love')
    //   }, {
    //     path: "/favorite",
    //     name: "favorite",
    //     component: () => import('../components/favorite')
    //   }, {
    //     path: "/travel",
    //     name: "travel",
    //     component: () => import('../components/travel')
    //   }, {
    //     path: "/message",
    //     name: "message",
    //     component: () => import('../components/message')
    //   }, {
    //     path: "/friend",
    //     name: "friend",
    //     component: () => import('../components/friend')
    //   }, {
    //     path: "/about",
    //     name: "about",
    //     component: () => import('../components/about')
    //   }, {
    //     path: "/user",
    //     name: "user",
    //     component: () => import('../components/user')
    //   }, {
    //     path: "/letter",
    //     name: "letter",
    //     component: () => import('../components/letter')
    //   }]
    // },
    {
        path: '/',
        name: 'resourcePathList',
        component: () => import('../components/admin/resourcePathList')


    },
    {

        path: "/videoCall",
        name: "videoCall",
        component: ()=>import('../components/VideoCall')
      },
       


]





    const router = new VueRouter({
        mode: "history",
        routes: routes,
        scrollBehavior(to, from, savedPosition) {
          return {x: 0, y: 0}
        }
      })
      
    //   router.beforeEach((to, from, next) => {
    //     debugger
    //     if (to.matched.some(record => record.meta.requiresAuth)) {
    //       if (!Boolean(localStorage.getItem("adminToken"))) {
    //         next({
    //           path: '/verify', //进入校验路径
    //           query: {redirect: to.fullPath}  //将跳转的路由path作为参数，登录成功后跳转到该路由
    //         });
    //       } else {
    //         next();
    //       }
    //     } else {
    //       next();
    //     }
    //   })
    export default router 